<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>你好React</title>
  <!-- 1. 引入react核心库 -->
  <script src="./node_modules/react/umd/react.development.js"></script>
  <!-- 2. 引入react-dom 用于支持react操作dom -->
  <script src="./node_modules/react-dom/umd/react-dom.development.js"></script>
  <div id="root"></div>
  <script>
    console.log('react', React, ReactDOM);
    // 3. 创建React元素
    /*
    * 三个API：
    * React.createElement(type代表元素的类型, 属性， 节点/子节点)
    * ReactDOM.createRoot   创建根节点 
    * render(ele) // 渲染元素到页面中
    */
    let title = React.createElement('h1', String, '你好React')
    // 4. 创建根节点
    // 17版本用法
    //ReactDOM.render(title, document.getElementById('root'))
    // 18用法
    let root = ReactDOM.createRoot(document.getElementById('root'))
    //5. 渲染到页面中
    root.render(title)
  </script>
</head>

<body>

</body>

</html>